﻿==============================================================================
DOSYA ADI  : ChatHandler.cpp
KAYNAK      :-GameServer\ChatHandler.cpp
SISTEM      : v2369 Reconnect - SUNUCU
BOYUT       : 108916 bayt / 3284 satir
ACIKLAMA    : /reconnecttest komut kaydi ve HandleReconnectTestCommand
ESLESME     : 6 satir / 2 blok
==============================================================================

NOT: Bu dosya yalnizca RECONNECT ile ilgili kod bloklarini icerir.
     Satir numaralari KAYNAK dosyadaki orijinal satirlardir.

----------------------------------------------------------------------
>> KAYNAK SATIR 75 - 125
----------------------------------------------------------------------
    75 | 		{ "tpall",				&CGameServerDlg::HandleTeleportAllCommand,			"Players send to home zone." },
    76 | 		{ "warresult",			&CGameServerDlg::HandleWarResultCommand,			"Set result for War" },
    77 | 		{ "utc",				&CGameServerDlg::HandleEventUnderTheCastleCommand,	"Open & close event Under the Castle zone" },
    78 | 		{ "tournamentstart",	&CGameServerDlg::HandleTournamentStart,				"Start is Clan Tournament" },
    79 | 		{ "tournamentclose",	&CGameServerDlg::HandleTournamentClose,				"Close is Clan Tournament" },
    80 | 		{ "chaosopen",			&CGameServerDlg::HandleChaosExpansionOpen,			"Open is Chaos Expansion" },
    81 | 		{ "borderopen",			&CGameServerDlg::HandleBorderDefenceWar,			"Open is Border Defence War" },
    82 | 		{ "juraidopen",			&CGameServerDlg::HandleJuraidMountain,				"Open is Juraid Mountain" },
    83 | 		{ "beefopen",			&CGameServerDlg::HandleBeefEvent,					"Open is Beef Event" },
    84 | 		{ "chaosclose",			&CGameServerDlg::HandleChaosExpansionClose,			"Chaos Expansion Close" },
    85 | 		{ "borderclose",		&CGameServerDlg::HandleBorderDefenceWarClose,		"Border Defence War Close" },
    86 | 		{ "juraidclose",		&CGameServerDlg::HandleJuraidMountainClose,			"Juraid Mountain Close" },
    87 | 		{ "lottery",			&CGameServerDlg::HandleLotteryStart,				"Lottery Start" },
    88 | 		{ "lotteryclose",		&CGameServerDlg::HandleLotteryClose,				"Lottery Close" },
    89 | 		{ "testing",			&CGameServerDlg::HandleServerGameTestCommand,		"Server Code Test Command" },
    90 | 		{ "aireset",			&CGameServerDlg::HandleAIResetCommand,				"AI Reset Komutu"	},
    91 | 		{ "block",				&CGameServerDlg::Handlebannedcommand,				"Player permanent ban" },
    92 | 		{ "bug",				&CGameServerDlg::HandleBugdanKurtarCommand,			"askida kalan karakteri kurtar" },
    93 | 		{ "reload_cind",		&CGameServerDlg::HandleReloadCindirellaCommand,		"Reloads the in-game Cindirella Table list" },
    94 | 		{ "exp_add",			&CGameServerDlg::HandleExpAddCommand,				"Sets the server-wide XP event. If bonusPercent is set to 0, the event is ended. Arguments: bonusPercent" },
    95 | 		{ "np_add",				&CGameServerDlg::HandleNPAddCommand,				"Sets the server-wide NP event. If bonusPercent is set to 0, the event is ended. Arguments: bonusPercent" },
    96 | 		{ "money_add",			&CGameServerDlg::HandleMoneyAddCommand,				"Sets the server-wide coin event. If bonusPercent is set to 0, the event is ended. Arguments: bonusPercent" },
    97 | 		{ "drop_add",			&CGameServerDlg::HandleDropAddCommand,				"Sets the server-wide drop event. If bonusPercent is set to 0, the event is ended. Arguments: bonusPercent" },
    98 | 		{ "event",				&CGameServerDlg::HandleSpecialEventOpenCommand,		"Reloads the in-game Cindirella Table list" },
    99 | 		{ "reloadatak",			&CGameServerDlg::HandleReloadCOEFFICIENTCommand,			"Reloads the in-game Item tables." },
   100 | 		{ "reconnecttest",		&CGameServerDlg::HandleReconnectTestCommand,		"Holds in-game users for a while before testing reconnect; 'stay in game' cancels the disconnect." },
   101 | 	};
   102 | 
   103 | 	init_command_table(CGameServerDlg, commandTable, s_commandTable);
   104 | }
   105 | 
   106 | void CGameServerDlg::CleanupServerCommands() { free_command_table(s_commandTable); }
   107 | 
   108 | void CUser::InitChatCommands()
   109 | {
   110 | 	static Command<CUser> commandTable[] =
   111 | 	{
   112 | 		// Command				Handler											Help message
   113 | 		{ "help",				&CUser::HandleHelpCommand,						"Show all commands." },
   114 | 		{ "resetloyalty",		&CUser::HandleResetRLoyaltyCommand,				"Reset Loyalty" },
   115 | 		{ "give",				&CUser::HandleGiveItemCommand,					"Gives a player an item. Arguments: character name | item ID | Count | Time" },
   116 | 		{ "zone_give_item",		&CUser::HandleOnlineZoneGiveItemCommand,		"Gives an item to the whole player. Arguments: ZoneID | item ID | Count | Time" },
   117 | 		{ "online_give_item",	&CUser::HandleOnlineGiveItemCommand,			"Gives an item to the whole player. Arguments: Item ID | Count | Time" },
   118 | 		{ "zone",				&CUser::HandleZoneChangeCommand,				"Teleports you to the specified zone. Arguments: +zone 'Zone ID' " },
   119 | 		{ "mon",				&CUser::HandleMonsterSummonCommand,				"Spawns the specified monster (does not respawn). Arguments: monster's database ID" },
   120 | 		{ "npc",				&CUser::HandleNPCSummonCommand,					"Spawns the specified NPC (does not respawn). Arguments: NPC's database ID" },
   121 | 		{ "kill",				&CUser::HandleMonKillCommand,					"Kill a NPC or Monster, Arguments: select an Npc and monster than use this command" },
   122 | 		{ "open1",				&CUser::HandleWar1OpenCommand,					"Opens war zone 1" },
   123 | 		{ "open2",				&CUser::HandleWar2OpenCommand,					"Opens war zone 2" },
   124 | 		{ "open3",				&CUser::HandleWar3OpenCommand,					"Opens war zone 3" },
   125 | 		{ "open4",				&CUser::HandleWar4OpenCommand,					"Opens war zone 4" },

----------------------------------------------------------------------
>> KAYNAK SATIR 2545 - 2612
----------------------------------------------------------------------
  2545 | 	ReLoadItemTable();
  2546 | 	printf("[ITEM] Table Reload\n");
  2547 | 	return true;
  2548 | }
  2549 | 
  2550 | COMMAND_HANDLER(CGameServerDlg::HandleCountCommand)
  2551 | {
  2552 | 	uint16 count = 0;
  2553 | 	for (uint16 i = 0; i < MAX_USER; i++)
  2554 | 	{
  2555 | 		CUser* pUser = g_pMain->GetUserPtr(i);
  2556 | 		if (pUser == nullptr || !pUser->isInGame())
  2557 | 			continue;
  2558 | 
  2559 | 		count++;
  2560 | 	}
  2561 | 
  2562 | 	m_BotcharacterNameLock.lock();
  2563 | 	count += (uint16)g_pMain->m_BotcharacterNameMap.size();
  2564 | 	m_BotcharacterNameLock.unlock();
  2565 | 
  2566 | 	printf("Online User Count : %d\n", count);
  2567 | 	return true;
  2568 | }
  2569 | 
  2570 | COMMAND_HANDLER(CGameServerDlg::HandleReconnectTestCommand)
  2571 | {
  2572 | 	uint16 count = 0;
  2573 | 	for (uint16 i = 0; i < MAX_USER; i++)
  2574 | 	{
  2575 | 		CUser* pUser = g_pMain->GetUserPtr(i);
  2576 | 		if (pUser == nullptr || !pUser->isInGame())
  2577 | 			continue;
  2578 | 
  2579 | 		// Karakteri SUSPENDED durumuna al: oyunda kalır ancak işlevsizdir.
  2580 | 		// SuspendForReconnect ayrıca reconnect token/ticket dağıtımını yapar ve
  2581 | 		// istemciye UI paneli paketini (requestType 5 + süre) gönderir.
  2582 | 		if (pUser->SuspendForReconnect(RECONNECT_TEST_HOLD_SECONDS, "reconnecttest"))
  2583 | 			count++;
  2584 | 	}
  2585 | 
  2586 | 	printf("[RECONNECT] Suspend armed for %d users (%u seconds). 'Yes' -> IN_GAME; sure dolunca karakter dusurulur.\n",
  2587 | 		count, (uint32)RECONNECT_TEST_HOLD_SECONDS);
  2588 | 	return true;
  2589 | }
  2590 | 
  2591 | void CGameServerDlg::SendFormattedResource(uint32 nResourceID, uint8 byNation, bool bIsNotice, ...)
  2592 | {
  2593 | 	_SERVER_RESOURCE* pResource = m_ServerResourceArray.GetData(nResourceID);
  2594 | 	if (pResource == nullptr)
  2595 | 		return;
  2596 | 
  2597 | 	string buffer;
  2598 | 	va_list ap;
  2599 | 	va_start(ap, bIsNotice);
  2600 | 	_string_format(pResource->strResource, &buffer, ap);
  2601 | 	va_end(ap);
  2602 | 
  2603 | 	if (bIsNotice)
  2604 | 		SendNotice(buffer.c_str(), byNation);
  2605 | 	else
  2606 | 		SendAnnouncement(buffer.c_str(), byNation);
  2607 | }
  2608 | 
  2609 | COMMAND_HANDLER(CUser::HandleServerGameTestCommand)
  2610 | {
  2611 | 	if (!isGM()) return false;
  2612 | 

